<%
/* Copyright 2010 Assert Developments
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
%>
                                                                          
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<f:setLocale value="${currentUser.language}_${currentUser.country}" scope="session"/>
<f:setTimeZone value="${currentUser.timeZone}" scope="session"/>
<spring:htmlEscape defaultHtmlEscape="true"/>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title><f:message key="account.title"/></title>

        <!-- metadata -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

        <!-- stylesheets -->
        <link rel="stylesheet" type="text/css" href="../css/${currentUser.theme}/main.css"/>
        <link rel="stylesheet" type="text/css" href="../css/${currentUser.theme}/forms.css"/>
        <link rel="stylesheet" type="text/css" href="../css/${currentUser.theme}/toolbar.css"/>
        <link rel="stylesheet" type="text/css" href="../css/${currentUser.theme}/account.css"/>

        <!-- scripts -->
        <!-- PNG transparency on IE 6 fix -->
        <!--[if IE 6]>
        <script type="text/javascript" src="../js/DD_belatedPNG.js"></script>
        <script type="text/javascript">
          DD_belatedPNG.fix('legend');
          DD_belatedPNG.fix('.error');
          DD_belatedPNG.fix('.savebutton');
        </script>
        <![endif]-->

    </head>
    <body>
        <!-- contents -->
        <div id="contents">

            <!-- account details form -->
            <form name="accountForm" class="simpleform" method="POST" action="account.html">

                <!-- buttons -->
                <div class="toolbar">
                    <a class="button" href="#" onclick="document.accountForm.submit();">
                        <span class="savebutton"><f:message key='account.save'/></span>
                    </a>

                    <div class="toolbarinfos">

                        <!-- modification date -->
                        <spring:bind path="command.modificationDate">
                            <span class="toolbarinfo">
                                <f:message key="account.modificationDate"/>
                                <f:formatDate
                                    value="${status.value}" type="both" dateStyle="short" timeStyle="medium"/>
                            </span>
                        </spring:bind>

                    </div>
                </div>

                <!-- profile fieldset -->
                <fieldset id="profile">

                    <legend><f:message key="account.profile.legend"/></legend>

                    <!-- email -->
                    <spring:bind path="command.email">
                        <div>
                            <strong><f:message key="account.email.help"/></strong>
                            <label for="${status.expression}"><f:message key="account.email"/></label>
                            <input maxlength=80 class="textfield" type="text"
                                name="${status.expression}" value="${status.value}"
                                style="width: 250px;"/>
                            <span class="required"><f:message key="account.required.star"/></span>
                            <c:if test="${not empty status.errorMessage}">
                                <span class="error">${status.errorMessage}</span>
                            </c:if>
                        </div>
                    </spring:bind>

                    <!-- name -->
                    <spring:bind path="command.name">
                        <div>
                            <strong><f:message key="account.name.help"/></strong>
                            <label for="${status.expression}"><f:message key="account.name"/></label>
                            <input maxlength=80 class="textfield" type="text"
                                name="${status.expression}" value="${status.value}"
                                style="width: 250px;"/>
                            <span class="required"><f:message key="account.required.star"/></span>
                            <c:if test="${not empty status.errorMessage}">
                                <span class="error">${status.errorMessage}</span>
                            </c:if>
                        </div>
                    </spring:bind>

                    <!-- description -->
                    <spring:bind path="command.description">
                        <div>
                            <strong><f:message key="account.description.help"/></strong>
                            <label for="${status.expression}"><f:message key="account.description"/></label>
                            <textarea rows=4 cols=40 name="${status.expression}">${status.value}</textarea>
                            <c:if test="${not empty status.errorMessage}">
                                <span class="error">${status.errorMessage}</span>
                            </c:if>
                        </div>
                    </spring:bind>

                </fieldset>

                <!-- regional fieldset -->
                <fieldset id="regional">

                    <legend><f:message key="account.regional.legend"/></legend>

                    <!-- country -->
                    <spring:bind path="command.country">
                        <div>
                            <strong><f:message key="account.country.help"/></strong>
                            <label for="${status.expression}"><f:message key="account.country"/></label>
                            <select class="combobox" name="${status.expression}" style="width: 125px;">
                                <c:forEach var="country" items="${countries}">
                                    <option value="${country}"
                                        <c:if test="${country eq status.value}">
                                            selected=selected
                                        </c:if>><f:message key="account.country.${country}"/></option>
                                </c:forEach>
                            </select>
                            <c:if test="${not empty status.errorMessage}">
                                <span class="error">${status.errorMessage}</span>
                            </c:if>
                        </div>
                    </spring:bind>

                    <!-- language -->
                    <spring:bind path="command.language">
                        <div>
                            <strong><f:message key="account.language.help"/></strong>
                            <label for="${status.expression}"><f:message key="account.language"/></label>
                            <select class="combobox" name="${status.expression}" style="width: 125px;">
                                <c:forEach var="language" items="${languages}">
                                    <option value="${language}"
                                        <c:if test="${language eq status.value}">
                                            selected=selected
                                        </c:if>><f:message key="account.language.${language}"/></option>
                                </c:forEach>
                            </select>
                            <c:if test="${not empty status.errorMessage}">
                                <span class="error">${status.errorMessage}</span>
                            </c:if>
                        </div>
                    </spring:bind>

                    <!-- timezone -->
                    <spring:bind path="command.timeZone">
                        <div>
                            <strong><f:message key="account.timezone.help"/></strong>
                            <label for="${status.expression}"><f:message key="account.timezone"/></label>
                            <select class="combobox" name="${status.expression}" style="width: 200px;">
                                <c:forEach var="timezone" items="${timezones}">
                                    <option value="${timezone}"
                                        <c:if test="${timezone eq status.value}">
                                            selected=selected
                                        </c:if>>${timezone}</option>
                                </c:forEach>
                            </select>
                            <c:if test="${not empty status.errorMessage}">
                                <span class="error">${status.errorMessage}</span>
                            </c:if>
                        </div>
                    </spring:bind>

                </fieldset>

                <!-- personalisation fieldset -->
                <fieldset id="personalisation">

                    <legend><f:message key="account.personalisation.legend"/></legend>

                    <!-- theme -->
                    <spring:bind path="command.theme">
                        <div>
                            <strong><f:message key="account.theme.help"/></strong>
                            <label for="${status.expression}"><f:message key="account.theme"/></label>
                            <select class="combobox" name="${status.expression}" style="width: 125px;">
                                <c:forEach var="theme" items="${themes}">
                                    <option value="${theme}"
                                        <c:if test="${theme eq status.value}">
                                            selected=selected
                                        </c:if>><f:message key="account.theme.${theme}"/></option>
                                </c:forEach>
                            </select>
                            <c:if test="${not empty status.errorMessage}">
                                <span class="error">${status.errorMessage}</span>
                            </c:if>
                        </div>
                    </spring:bind>

                </fieldset>

            </form>

        </div>

    </body>
</html>